package queue;

import java.util.Scanner;

/**
 * @author tong
 * @date 2021/12/21 14:47
 */
public class ArrayQueueDemo {
    public static void main(String[] args) {
        ArrayQueue arrayQueue = new ArrayQueue(5);
        char key;
        boolean loop = true;
        System.out.println("s-显示队列");
        System.out.println("a-添加数据");
        System.out.println("g-取出数据");
        System.out.println("h-查看head");
        System.out.println("e-退出");
        while (loop) {
            Scanner scanner = new Scanner(System.in);
            key = scanner.next().charAt(0);
            switch (key) {
                case 's':
                    arrayQueue.showQueue();
                    break;
                case 'a':
                    System.out.println("add:");
                    int data = scanner.nextInt();
                    arrayQueue.addQueue(data);
                    break;
                case 'g':
                    System.out.println(arrayQueue.getQueue());
                    break;
                case 'h':
                    System.out.println(arrayQueue.headQueue());
                    break;
                case 'e':
                    loop = false;
                    break;
            }
        }
    }
}
